<?php include "../../config.php";?>
<?php include ROOT_PATH_."/front/m2/coresection/checkUserSession.php";?>
<? $site     = select_one_line_all_items($table_Prefix."site","nid !='-1' ");?>


<?
if(date("H")<10){$at="1";}
elseif(date("H")>16){$at="3";}
else{$at="2";}
?>


<?//如果接收到功号，就先把订单状态修改加一?>
<?//如果接收到功号，就先把订单状态修改加一?>
<?//如果接收到功号，就先把订单状态修改加一?>
<?//如果接收到功号，就先把订单状态修改加一?>
<?//如果接收到功号，就先把订单状态修改加一，之后再统计数目?>
<?//如果接收到功号，就先把订单状态修改加一，之后再统计数目?>
<?//如果接收到功号，就先把订单状态修改加一，之后再统计数目?>
<?//如果接收到功号，就先把订单状态修改加一，之后再统计数目?>

<?

$is_keyword = 0;

if($_REQUEST['keywordes']){
$admin_keywordes=$_REQUEST['keywordes'];
$table=$table_Prefix."orderlist";
$today=date("Y-m-d");
$now=date("Y-m-d H:i:s");

$is_keyword = 1;

$employee_orderlist=select_lines_all_items($table_prefix."orderlist","","order_date ='".date("Y-m-d")."' and order_at ='$at' and (status != '取消' or status is null) and (user_id ='$admin_keywordes' OR  user_name ='$admin_keywordes' ) ","","");

    $sql = "update $table set search_status= search_status+1 ,search_time='$now' where (order_date='$today' and order_at='$at' and ( user_id
='$admin_keywordes' OR  user_name ='$admin_keywordes'))";


    $query = mysql_query($sql) or die ("error:".mysql_error());

}


?>

<? $orderlist=select_lines_all_items($table_prefix."orderlist","","order_date ='".date("Y-m-d")."' and order_at ='$at' and (status != '取消' or status is null) ","",""); ?>
<?
$orderlist_1d=transform_2darray_in_1darray_number_as_key($orderlist,"search_status");
$condition['data']=$orderlist_1d;
$condition['rang']="";
$condition['target']="0";

$noteaten=count_num_in_array($condition);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include ROOT_PATH_.'/controlbase/modules/head.php'; ?>
    <script type="text/javascript" src="/js/metro.js"></script>
	
<style>
/*专门为平板设置的样式*/
body{font-size:32px; background-color: #ffffff}
.header{width:100%;padding:0px;margin:0px; border-bottom:solid 2px #060;border-top:solid 2px #060; overflow:hidden; height:80px!important;min-height:80px!important}

.keyword{width:70%;height:80px!important;padding:0px 0px 0px 15px;margin:0px -15px 0px 0px; border:none!important; font-size:70px!important;float:left}
.header .submitbutton{width:30%;height:80px!important;background-color:#060;padding:0px;margin:0px;
font-size:70px!important;color:#FFF; border:none!important; float:left; }

.header form{ margin:0px; padding:0px;}

table.admin_list_table{ margin:0px!important; font-size:58px;}
table.checkTable thead tr td { padding:10px;}
	
.main{width:100%;}
 
#metro{position:fixed;left:0px;top:0px;background-color:#222222;width:100%; height:0px;padding:0px;z-index:100000; float:left;overflow:hidden;color:#ffffff; background-color:#ececec }

.check_order_list tr td{ font-size:38px; height:45px; line-height:40px;}

</style>

</head>

<body>

<?php include ROOT_PATH_.'/controlbase/modules/metro.php'; ?>

<div class="header">


<form action="index.php" method="post" autocomplete="off" enctype="multipart/form-data">
 
 <?
 if(!$admin_keywordes)
 {$word="请输入会员号，名字";}
else
{$word=$admin_keywordes;}
?>
 
<input id="keywordes" name="keywordes" placeholder="<?echo $word?>" class="keyword" onfocus="" />
<input type="submit" value="查询<?switch($at){
    case 1:
        echo "早餐";
        break;
    case 2:
        echo "午餐";
        break;
    case 3:
        echo "晚餐";
        break;
}
?>" class="submitbutton" />
 
 <script type="text/javascript">
document.getElementById("keywordes").focus();
</script>

        <div style="display:none">
        就餐时间：<select name="year">
            <option value="<?echo date("Y",time())?>"><?echo date("Y",time())?></option>
            <option value="<?echo date("Y",time())-1?>"><?echo date("Y",time())-1?></option>
        </select>
        年
        <select name="month">
            <option value="01" class="month_1">01</option>
            <option value="02" class="month_2">02</option>
            <option value="03" class="month_3">03</option>
            <option value="04" class="month_4">04</option>
            <option value="05" class="month_5">05</option>
            <option value="06" class="month_6">06</option>
            <option value="07" class="month_7">07</option>
            <option value="08" class="month_8">08</option>
            <option value="09" class="month_9">09</option>
            <option value="10" class="month_10">10</option>
            <option value="11" class="month_11">11</option>
            <option value="12" class="month_12">12</option>
        </select>
        月
        <select name="days">
            <option value="0">全部</option>
            <option value="01">01</option><option value="02">02</option><option value="03">03</option>
            <option value="04">04</option><option value="05">05</option><option value="06">06</option>
            <option value="07">07</option><option value="08">08</option><option value="09">09</option>
            <option value="10">10</option><option value="11">11</option><option value="12">12</option>
            <option value="13">13</option><option value="14">14</option><option value="15">15</option>
            <option value="16">16</option><option value="17">17</option><option value="18">18</option>
            <option value="19">19</option><option value="20">20</option><option value="21">21</option>
            <option value="22">22</option><option value="23">23</option><option value="24">24</option>
            <option value="25">25</option><option value="26">26</option><option value="27">27</option>
            <option value="28">28</option><option value="29">29</option><option value="30">30</option>
            <option value="31">31</option>
        </select>
        日
        <select name="ats">
            <option value="0">全部</option>
            <option value="1">早</option>
            <option value="2">午</option>
            <option value="3">晚</option>
        </select>
        餐
 
    </form>
    
    </div>
    
    
</div>

 

<div class="main">
 
 <div style="text-align:left; color:red; font-weight:blod; margin:15px; overflow:hidden"> 
 
 <span style="float:left">当前会员号: <? echo $admin_keywordes ?></span>
 <span style="float:left; margin-left:65px;">未就餐订单:<? echo $noteaten ?></span>
 <span style="float:left; margin-left:65px;">已就餐订单:<? echo count($orderlist)-$noteaten ?></span>
 <span style="float:left; margin-left:65px;">总就餐订单:<? echo count($orderlist) ?></span>
 

 <span style="float:right; font-size:28px;">
 <a href="#" style=" background-color:#060; color:#ffffff;text-decoration: none;
    padding: 0px 8px;" onClick="resize('metro',{height:getheight()})">
 <? echo $searchStr ?>
 详情 >>
 </a>
 </span>
 
 </div>

    <style>
.check_order_list thead tr td{font-size: 50px;height:50px;color: #000000}
    </style>
 
        <table cellspacing="0" cellpadding="0" border="0" class="layui-table check_order_list">

            <colgroup>
                <col width="200">
                <col width="150">
                <col>
                <col width="150">
            </colgroup>

            <thead>
            <tr>
     
                <td>订餐人</td>
                <td>时段</td>
                <td>菜式</td>
                <td>份数</td>
            </tr>
            </thead>
            <tbody>


			
<? 

if
(
($employee_orderlist[0]['search_status']!='0') and
($employee_orderlist[0]['search_status']!="")
)
{?>

<tr>
<td colspan='4' style="padding:20px;text-align:center">

<b style="font-size:45px;color:red;">该用户已经领餐<?echo $employee_orderlist[0]['search_status']?>次，请注意查询。</b>
</td>
</tr>

<?;}?>


            
<?php
            for($i=0;$i<count($employee_orderlist);$i++){?>
     <tr>
                   
                    
                    <td><? if ($employee_orderlist[$i]['user_name']==$employee_orderlist[($i-1)]['user_name']) { echo "" ;} else{ echo $employee_orderlist[$i]['user_name']; }?> </td>
                    <td><?switch($employee_orderlist[$i]['order_at']){
                            case 1:
                                echo "早餐";
                                break;
                            case 2:
                                echo "午餐";
                                break;
                            case 3:
                                echo "晚餐";
                                break;
                        }
                        ?></td>
                    <td class="productId productId_<?echo $search_id[$i]?>"  style="color:#9c0b0b" data-id="productId_<?echo $search_id[$i]?>">
					<? if($search_status[0]>1)
					   {echo "已领取<span style='color:#555555;font-size:40px;'>(".$search_name[$i].")</span>";} 
				
				       else{ echo $employee_orderlist[$i]['product_name'] ;}
					?>
					
					 
					</td>

                    <td class="hide"><?echo $employee_orderlist[$i]['product_num']?> </td>
                </tr>
            <? } ?>
            </tbody>
        </table>
		
		<div style="margin-top:15px;">
		<?
		if(count($employee_orderlist)==0 && $is_keyword == 1)
		{ echo '当前会员号没有点餐信息 <audio controls="controls"  autoplay="autoplay" style="display:none;">
  <source src="/js/state3.mp3" type="audio/mpeg">
</audio>
';
		}
		elseif(count($employee_orderlist)> 0 && $employee_orderlist[0]['search_status']!='0' && $employee_orderlist[0]['search_status']!="")
		{ echo '<audio controls="controls"  autoplay="autoplay" style="display:none;">
  <source src="/js/state2.mp3" type="audio/mpeg">
</audio>
';
		}
		elseif(count($employee_orderlist)> 0)
		{ echo '<audio controls="controls"  autoplay="autoplay" style="display:none;">
  <source src="/js/state1.mp3" type="audio/mpeg">
</audio>
';
		}

		elseif(count($employee_orderlist)==0){
		
			 echo '当前会员号没有点餐信息';
		}		

		?>
		</div>
    </div>
</div>
<br />
<br />
<br />
<br />

<div class="footer"><?php include ROOT_PATH_.'controlbase/modules/footer.php'; ?></div>

</body>
</html>
